<?php

namespace App\Controllers;

class Home extends BaseController
{
    public function index(): string
    {
        //return view('home');
        // connect to the model
        $places = new \App\Models\Places();
        // retrieve all the records
        $records = $places->findAll();
        
        // （补充：将数据传递给视图，比如加载travel视图并传参）
        // get a template parser
$parser = \Config\Services::parser();
// tell it about the substitutions
return $parser->setData(data: ['records' => $records])
    // and have it render the template with those
    ->render(view: 'placeslist');
    }
}
